import * as types from "../types/recyclePriceInfoTypes";
import NetWorkUtil from "../utils/NetWorkUtil";
import ApiConstants from "../common/ApiConstants";

export function getRecyclePriceInfo(facility_id) {
  return dispatch => {
    dispatch({ type: types.RECYCLEPRICEINFO_INITING });
    NetWorkUtil.getWithoutLogin(ApiConstants.DEVICEMODEL_RECYCLEPRICEINFO, { facility_id })
      .then(res => {
        dispatch({ type: types.RECYCLEPRICEINFO_DONE, priceInfo: res });
      })
      .catch(error => {
        dispatch({ type: types.RECYCLEPRICEINFO_ERROR, error });
      });
  };
}

export function recyclePriceInfoUnmount() {
  return dispatch => {
    dispatch({ type: types.RECYCLEPRICEINFO_SERVICEINFOUNMOUNT });
  };
}
